Skip to content

CAMEL-23903: Fix flaky test RouteIdTransactedIT in camel-jms#24420

Merged
gnodet merged 2 commits into
apache:mainfrom
gnodet:camel-23903-fix-flaky-test-routeidtransactedit-in
Jul 5, 2026
Merged

CAMEL-23903: Fix flaky test RouteIdTransactedIT in camel-jms#24420
gnodet merged 2 commits into
apache:mainfrom
gnodet:camel-23903-fix-flaky-test-routeidtransactedit-in

Conversation

@gnodet

@gnodet gnodet commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix flaky RouteIdTransactedIT.testRouteIdFailed (and testRouteId for consistency) by replacing MockEndpoint.assertIsSatisfied(context) with MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS).

Root cause: The default MockEndpoint latch timeout is 10 seconds (waitForCompleteLatch defaults to 10s when resultWaitTime=0). In transacted JMS routes under CI load on JDK 17, the message processing (including transaction handling and exception routing via onException) can exceed this timeout, causing intermittent test failures.

Fix: Use the MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS) overload which sets resultWaitTime directly on each mock's internal latch, giving transacted routes a generous 30-second window. This follows the same pattern already used in other camel-jms tests (e.g., JmsProducerConcurrentWithReplyTest, JmsInOnlyWithReplyToHeaderTopicTest).

Test plan

  • RouteIdTransactedIT passes (2 tests, 0 failures)
  • CI build passes

Claude Code on behalf of Guillaume Nodet

🤖 Generated with Claude Code

Replace MockEndpoint.assertIsSatisfied(context) with Awaitility's
untilAsserted() in both testRouteId() and testRouteIdFailed() to
provide a generous 30-second timeout for transacted JMS message
processing, which can exceed the default 10-second latch timeout
under CI load on JDK 17.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
@gnodet gnodet requested review from davsclaus and orpiske July 4, 2026 17:03
@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🌟 Thank you for your contribution to the Apache Camel project! 🌟
🤖 CI automation will test this PR automatically.

🐫 Apache Camel Committers, please review the following items:

  • First-time contributors require MANUAL approval for the GitHub Actions to run
  • You can use the command /component-test (camel-)component-name1 (camel-)component-name2.. to request a test from the test bot although they are normally detected and executed by CI.
  • You can label PRs using skip-tests and test-dependents to fine-tune the checks executed by this PR.
  • Build and test logs are available in the summary page. Only Apache Camel committers have access to the summary.

⚠️ Be careful when sharing logs. Review their contents before sharing them publicly.

@github-actions

github-actions Bot commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

🧪 CI tested the following changed modules:

  • components/camel-jms

🔬 Scalpel shadow comparison — Scalpel: 1 tested, 0 compile-only — current: 12 all tested

Maveniverse Scalpel detected 1 affected modules (current approach: 12).

Modules only in current approach (11)
  • camel-activemq
  • camel-activemq6
  • camel-amqp
  • camel-jbang-mcp
  • camel-jbang-plugin-mcp
  • camel-jbang-plugin-route-parser
  • camel-jbang-plugin-tui
  • camel-jbang-plugin-validate
  • camel-launcher-container
  • camel-yaml-dsl-validator
  • camel-yaml-dsl-validator-maven-plugin

Skip-tests mode would test 1 modules (1 direct + 0 downstream), skip tests for 0 (generated code, meta-modules)

Modules Scalpel would test (1)
  • camel-jms

ℹ️ Shadow mode — Scalpel observes but does not affect test execution. Learn more

⚠️ Some tests are disabled on GitHub Actions (@DisabledIfSystemProperty(named = "ci.env.name")) and require manual verification:

  • components/camel-jms: 1 test(s) disabled on GitHub Actions
All tested modules (12 modules)
  • Camel :: AMQP
  • Camel :: ActiveMQ 5.x
  • Camel :: ActiveMQ 6.x
  • Camel :: JBang :: MCP
  • Camel :: JBang :: Plugin :: MCP
  • Camel :: JBang :: Plugin :: Route Parser
  • Camel :: JBang :: Plugin :: TUI
  • Camel :: JBang :: Plugin :: Validate
  • Camel :: JMS
  • Camel :: Launcher :: Container
  • Camel :: YAML DSL :: Validator
  • Camel :: YAML DSL :: Validator Maven Plugin

⚙️ View full build and test results

@gnodet gnodet marked this pull request as ready for review July 4, 2026 22:38
@gnodet gnodet requested a review from Copilot July 4, 2026 22:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses flakiness in the RouteIdTransactedIT JMS transacted integration tests by replacing a single-shot MockEndpoint.assertIsSatisfied(context) assertion with an Awaitility-based retry window, aiming to better tolerate CI timing variability around transacted processing and onException handling.

Changes:

  • Add Awaitility untilAsserted() around mock assertions in testRouteId and testRouteIdFailed.
  • Introduce TimeUnit and Awaitility static import to support the new wait logic.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +53 to +54
await().atMost(30, TimeUnit.SECONDS)
.untilAsserted(() -> MockEndpoint.assertIsSatisfied(context));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — switched to MockEndpoint.assertIsSatisfied(context, 30, TimeUnit.SECONDS) in e38a078.

Comment on lines +68 to +69
await().atMost(30, TimeUnit.SECONDS)
.untilAsserted(() -> MockEndpoint.assertIsSatisfied(context));

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — same fix applied here.

import org.junit.jupiter.api.TestMethodOrder;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import static org.awaitility.Awaitility.await;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done — Awaitility import removed.

Address Copilot review: use MockEndpoint.assertIsSatisfied(context, 30,
TimeUnit.SECONDS) which sets the timeout directly on the mock's internal
latch, rather than wrapping with Awaitility which only retries the
default 10-second wait.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Guillaume Nodet <gnodet@gmail.com>
@gnodet gnodet self-assigned this Jul 5, 2026
@gnodet gnodet added this to the 4.21 milestone Jul 5, 2026
@gnodet gnodet merged commit e3484da into apache:main Jul 5, 2026
5 checks passed
@gnodet gnodet deleted the camel-23903-fix-flaky-test-routeidtransactedit-in branch July 5, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants